//
// Created by 67678 on 2023/3/14.
//
#include "timer.h"
#include <iostream>
#include <chrono>
#include <thread>
#include "../../util/testInit.h"

using namespace std;
using namespace chrono;


void test() {
    Timer &timer = Timer::getInstance();

    auto test = [](Time tm) {
        cout << tm.tfd << endl;
        cout << tm.times << endl;
        cout << endl;

    };
    timer.addTimer_for(100ms, test, 3);
    int tid = timer.addTimer_for(100ms, test, -1);
    timer.addTimer_until(chrono::high_resolution_clock::now() + 1s, test);
    this_thread::sleep_for(1s);
    timer.delTimer(tid);
    this_thread::sleep_for(100s);
}

int main() {
    init();
    test();
}